package cn.hallele.leinsteining.mc.infrastructure.metadata.enums;

import lombok.Getter;

/**
 * 微服务
 *
 * @author anle5
 * @since 2024/7/27 12:31
 */
@Getter
public enum ServiceEnum {
    USER_CENTER("UserCenter", 20010),
    MONITOR_CENTER("MonitorCenter", 20100),
    PORTAL_CENTER("PortalCenter", 20020),
    FILE_CENTER("FileCenter", 20030),
    CRAWLER_CENTER("CrawlerCenter", 20040),
    TASK_CENTER("TaskCenter", 20050),
    NOTIFICATION_CENTER("NotificationCenter", 20060),
    OUTGOING_CENTER("OutgoingCenter", 20070),
    AUDIT_CENTER("AuditCenter", 20080);

    /**
     * 微服务名字
     */
    private final String name;

    /**
     * 端口
     */
    private final int port;

    ServiceEnum(String name, int port) {
        this.name = name;
        this.port = port;
    }

    public static ServiceEnum getServiceEnum(String name) {
        for (ServiceEnum serviceEnum : ServiceEnum.values()) {
            if (serviceEnum.getName().equals(name)) {
                return serviceEnum;
            }
        }
        return null;
    }
}
